package com.example.logistics_oa.controller;

import com.example.comment_oa.pojos.SalaryReview;
import com.example.comment_oa.response.AjaxResponse;
import com.example.logistics_oa.service.SalaryReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author:李博文
 * @Date:2022/10/14 14:32
 */
@RestController
@RequestMapping("/JianChaShenHeDan")
@CrossOrigin
public class ShenHeZongDanController {

    @Autowired
    SalaryReviewService salaryReviewService;

    @GetMapping("/JianChaYouWu")
    public AjaxResponse ShenHegongzidan(){

        //  if判断  return  true 就不能在审核 工资了
        if(salaryReviewService.selectAllByDate()){
           return AjaxResponse.success(true);
        } else{
            SalaryReview chakan = salaryReviewService.chakan();
            salaryReviewService.insertAll(chakan);
            return AjaxResponse.success(false);
        }

    }
}
